<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增【请填写功能名称】')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-city-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">国家：</label>
            <div class="col-sm-8">
                <!--<input name="countryId" class="form-control" type="text">-->
                <!--<select name="countryId" id="countryId" lay-verify="required" class="input-block-leve" onchange="getExpressCompany()">
                    <option th:value="">所有</option>
                </select>-->
                <select id="country" class="form-control m-b" name="countryId">
                    <option value="">--请选择国家--</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">省份名称：</label>
            <div class="col-sm-8">
                <input name="city" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">排序：</label>
            <div class="col-sm-8">
                <input name="initial" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
    //页面一加载调取后台查询全部国家的方法
    $.ajax({
        url:ctx + "app/country/appList",
        type:"post",
        dataType:"json",
        success:function(data){
            console.log(data)
            $(data.data).each(function(a,b){
                var countryId = b.id;
                $("#country").append("<option value='"+countryId+"'>"+b.country+"</option>");
            });
        },
        error:function(){
        }
    });

    var prefix = ctx + "app/city"
    $("#form-city-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-city-add').serialize());
        }
    }
</script>
</body>
</html>